package arithmeticTriplets;

public class Solution {
    public int arithmeticTriplets(int[] nums, int diff) {
        int[]  marks = new int[201];
        for (int num: nums) {
            marks[num]++;
        }
        int ans = 0;
        for (int i = diff; i <= 200-diff; i++) {
            ans+=(marks[i]*marks[i-diff]*marks[i+diff]);
        }
        return ans;
    }
}
